//- 先去这个pug文件中找
extends shopHead_nav.pug

block append pageStyle
	link(href="${relativePath}/static/css/shopping/shopIndex.css" rel="stylesheet" type="text/css")
	link(href="${relativePath}/static/css/shopping/materFinished.css" rel="stylesheet" type="text/css")
	link(href="${relativePath}/static/css/shopping/service.css" rel="stylesheet" type="text/css")
	link(href="${relativePath}/static/css/shopping/search.css" rel="stylesheet" type="text/css")
	link(href="${relativePath}/static/css/shopping/colleague.css" rel="stylesheet" type="text/css")
	link(href="${relativePath}/static/css/shopping/hot.css" rel="stylesheet" type="text/css")
	link(href="${relativePath}/static/css/shopping/allkinds.css" rel="stylesheet" type="text/css")


block matrialContent
	//- 成品材料内容
	div.matrialCon.layout
		div.productsBox
			div.list
				ul
					li
						span.cur 当前位置：
						a(href="javascript:;")
							| 标识汇>
							a(href="./colleague.html") 同行
							| >推荐朋友
		div.chioceBox
			div.list
				lable.name.fl 已选：
				div.chioce.chiocecom.fl
					div.ejkinds.fl
						//- a.alred.fl(href="javascript:;") 成品材料
					div.areas.fl
						//- a.alred.fl(href="javascript:;") 北京
					//- div.clearfix
				div.clearfix
			div.list
				div.chioce.morebtn.fl
					div.cpcl.cpcl1.fl
					a.moreSelect.fr(href='javascript:;') 更多 
					div.clearfix
				div.clearfix
				//- 成品材料、定制加工二级分类
				div.twoWrap.twoWrap1

			div.list
				lable.name.fl 地区：
				div.chioce.fl
					a.getchioce.area.fl(href="javascript:;") 北京
					a.getchioce.area.fl(href="javascript:;") 重庆
					a.getchioce.area.fl(href="javascript:;") 天津
					div.clearfix
				div.clearfix
		ul.tabList
			li.current(tag="1") 浏览量
			li(tag="2") 更新频率
			div.clearfix
		div.hot-box
			//- 浏览量
			div.history.showbox.active
			
			//- 更新频率	
			div.freq.showbox
			div.clearfix

	//- 三级分类列表模板
	script#threeList(type="text/html")
		| {{each data arr}}
		div.itemList
			lable.proname.fl {{arr.name}} ：
			div.rightList.fl
				| {{set two = arr.child}}
				| {{each two twolist}}
				a.fl.black(href="javascript:;" id="{{twolist.id}}") {{twolist.name}}
				| {{/each}}
			div.clearfix
		| {{/each}}	
	//- 浏览量
	script#history(type="text/html")
		| {{set data = data.members}}
		| {{each data arr}}
		div.hot-list.fl
			div.leftImg.fl
				img(src="{{arr.company_logo}}")
			div.right-con.fl
				p.nowrap.com-name.tjName 
					| {{arr.nice_name}}
					span.positonName {{arr.department_name}}
					| {{if arr.is_identification == 2}}
					img(src="${relativePath}/static/imgs/shi.png")
					| {{/if}}

				div.center.bottomt
					div.litte.nowrap.years.comname.fl
						| {{if arr.auth =='4'}}
						img(src="${relativePath}/static/imgs/gsh.png")
						| {{else}}
						img(src="${relativePath}/static/imgs/gsg.png")
						| {{/if}}
						|   {{arr.company_name}}
					div.clearfix
				div.center.bottomp
					div.litte.nowrap.phone
						img(src="${relativePath}/static/imgs/phone2.png")  
						|  电话：{{arr.phone}}
				div.btm.hbtm
					| {{set list = arr.tags}}
					| {{each list tag}}
					a(href="javascript:;") {{tag.name}}
					| {{/each}}
				//- 定制下单按钮
				a.mized 定制下单
			div.clearfix
		| {{/each}}
	//- 更新频率列表
	script#freq(type="text/html")
		| {{set data = data.members}}
		| {{each data arr}}
		div.hot-list.fl
			div.leftImg.fl
				img(src="{{arr.company_logo}}")
			div.right-con.fl
				p.nowrap.com-name.tjName 
					| {{arr.nice_name}}
					span.positonName {{arr.department_name}}
					| {{if arr.is_identification == 2}}
					img(src="${relativePath}/static/imgs/shi.png")
					| {{/if}}

				div.center.bottomt
					div.litte.nowrap.years.comname.fl
						| {{if arr.auth =='4'}}
						img(src="${relativePath}/static/imgs/gsh.png")
						| {{else}}
						img(src="${relativePath}/static/imgs/gsg.png")
						| {{/if}}
						|   {{arr.company_name}}
					div.clearfix
				div.center.bottomp
					div.litte.nowrap.phone
						img(src="${relativePath}/static/imgs/phone2.png")  
						|  电话：{{arr.phone}}
				div.btm.hbtm
					| {{set list = arr.tags}}
					| {{each list tag}}
					a(href="javascript:;") {{tag.name}}
					| {{/each}}
				//- 定制下单按钮
				a.mized 定制下单
			div.clearfix
		| {{/each}}
	//- 浏览量分页
	div.pageBox.pageBox1
		nav.pageNav
			div.paginationOne.page
	//- 更新频率分页
	div.pageBox.pageBox2
		nav.pageNav
			div.paginationOne.page

block pageScript
	script(src="${relativePath}/static/js/shopping/kinds.js")

	script.
		var TAG = 1
		$(function(){
			$("#colleague").addClass("active");
			$("#cpcl").click(function(){
				window.location.href='materFinished.html';
			});
			$("#hyfw1").click(function(){
				window.location.href='industryServiceIndex.html';
			});
			$("#index").click(function(){
				window.location.href='materIndex.html';
			});
			
			$(".left span").click(function(){
				$(this).addClass("current").siblings().removeClass("current");
			})
			//- 获取分类
			getType(0)
			//- 点击切换浏览量和更新频率
			$(".tabList li").click(function() {
				var index = $(this).index()
				if(index==0) {
					$(".pageBox1").show()
					$(".pageBox2").hide()
				}else{
					$(".pageBox2").show()
					$(".pageBox1").hide()
				}
				TAG = $(this).attr('tag')
				$(this).addClass('current').siblings().removeClass('current')
				$(".showbox").eq(index).addClass('active').siblings().removeClass('active')
				historyList(1)
			})
			//- 获取推荐朋友列表
			function historyList(pageNum) {
				$.post(shopIp+'/peer/recommendUser',{
					userToken:token,
					page:pageNum,
					sort:TAG,
					tags:THREEID,
					size:10
				},function(res) {
					if(TAG == 1) {
						$('.history').empty()
						var list = res.data
						if(list.members.length==0) {
							$('.history').html("<img class='imgBig' src='${relativePath}/static/imgs/zw.png' style='margin-bottom:250px;'/>")
							$(".history").css("text-align","center");
						}else{
							var hot = template('history',res)
							$('.history').append(hot)
						}
						$(".pageBox1 .page").html("").pagination({
							pageCount : list.total_page,
							current : pageNum,
							keepShowPN : true,
							count : 2,
							homePage : "1",
							endPage : list.total_page,
							coping : true,
							prevContent : "< 上一页",
							nextContent : "下一页 >",
							callback : function(page) {
								historyList(page.getCurrent());
							}
						});
					}else{
						$('.freq').empty()
						var list = res.data
						if(list.members.length==0) {
							$('.history').html("<img class='imgBig' src='${relativePath}/static/imgs/zw.png' style='margin-bottom:250px;'/>")
							$(".history").css("text-align","center");
						}else{
							var hot = template('freq',res)
							$('.freq').append(hot)
						}
						$(".pageBox2 .page").html("").pagination({
							pageCount : list.total_page,
							current : pageNum,
							keepShowPN : true,
							count : 2,
							homePage : "1",
							endPage : list.total_page,
							coping : true,
							prevContent : "< 上一页",
							nextContent : "下一页 >",
							callback : function(page) {
								historyList(page.getCurrent());
							}
						});
					}
					
				})
			}
			historyList(1)
				//- 点击二级分类
			$(".twoWrap").on("click",'.rightList a',function(){
				$(this).closest('.twoWrap').find('.active').removeClass('active');
				$(this).addClass('active')
				$(".ejkinds").html('<a class="alred fl">'+$(this).text()+'</a>')
				THREEID = $(this).attr('id')
				historyList(1)
			})
		});